package com.zebraphp.devtool.httpUtils.NetOkHttp.requestBuilder;

import com.zebraphp.devtool.httpUtils.NetOkHttp.IOkHttp;

import java.util.LinkedHashMap;
import java.util.Map;


/**
 * 带 参数 请求体 的 构建类
 * BaseBuilder 包装
 */
public abstract class BaseWithParamBuilder<T extends BaseWithParamBuilder> extends BaseBuilder<T> {

    protected Map<String, String> mParams;//带请求参数

    public BaseWithParamBuilder(IOkHttp IOkHttp) {
        super(IOkHttp);
    }

    /* 设置请求参数 */
    public T setParams(Map<String, String> params) {
        this.mParams = params;
        return (T) this;
    }

    /* 单个添加请求参数 */
    public T addParam(String key, String val) {
        if (this.mParams == null) {
            mParams = new LinkedHashMap<>();
        }
        mParams.put(key, val);
        return (T) this;
    }
}
